var BASE_DIR = __dirname + '/../';
var UTIL = BASE_DIR + '/util/';
var CONF = BASE_DIR + '/config/';

var CertficateCoder = require(UTIL + 'CertificateCoder');
var ConfUtil = require(UTIL + 'ConfUtil');

ConfUtil.init(CONF + 'upay.properties');
var priKeyPath = ConfUtil.get('keystore.priKeyPath');
var pubKeyPath = ConfUtil.get('keystore.pubKeyPath');
CertficateCoder.init(BASE_DIR + priKeyPath, BASE_DIR + pubKeyPath);

var srcStr = 'HelloWorld';
var signedStr = CertficateCoder.sign(srcStr);
console.log('srcStr:' + srcStr);
console.log('signedStr:' + signedStr);
var flag = CertficateCoder.verify(srcStr, signedStr);
console.log('verify:' + flag);
